<?php
class imageApi extends core
{
	public function verificationAction($arg)
	{
		include ROOT . '/libs/Zend/Captcha/Image.php';
		include ROOT . '/libs/Zend/Session/Namespace.php';
		
		$codeSession	= new Zend_Session_Namespace('code');
		$parm		= array(
			'font'		=> ROOT . 'libs/HoboStd.otf',
			'fontsize'	=> 24,
			'imgdir'	=> ROOT . 'libs/verification/',
			'session'	=> $codeSession,
			'width'		=> 100,
			'height'	=> 50,
			'wordlen'	=> 5,
		);
		if (!is_dir(ROOT . 'libs/verification/')) mkdir(ROOT . 'libs/verification/');
		
		
		$captcha	= new Zend_Captcha_Image($parm);
		
		$captcha->getGcFreq(3);
		$captcha->generate();
		//var_dump($captcha->getImgDir(),$captcha->getId(),$captcha->getWord(),$codeSession->code);
		header('Content-Type:image/png');
		die(file_get_contents($captcha->getImgDir().$captcha->getId().'.png'));
	}
}